# -*- coding:utf-8 -*-

"""
基础请求类
"""
import requests
import time


def warpRequest(fun):
    def inner(self, **kwargs):
        startTime = time.time()
        fun(self, **kwargs)
        endTime = time.time()
        requestTime = endTime - startTime
        print(7 + requestTime)

    return inner


class RequestBase:
    def __init__(self, method, url):
        self.method = method
        self.url = url

    @warpRequest
    def requestBase(self, **kwargs):
        result = requests.request(self.method, self.url, **kwargs)
        return result


class BARequest(RequestBase):

    def beforeRequest(self):
        pass

    def afterRequest(self):
        pass

# RequestBase("GET", "https://www.baidu.com").requestBase()
